package top.dprkshow.springboothelloworld.utils;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * Java日期格式练习
 * @author Kent HAN
 * @date 2021/7/12
 */
public class JavaDate {

    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss-SSS");
        System.out.println(sdf.format(new Date()));
        System.out.println(new Date());

        StringBuilder stringBuilder = new StringBuilder("foobar");
        System.out.println(String.valueOf(stringBuilder));

        DecimalFormat df = new DecimalFormat("000000000");
        String random = df.format(new Random().nextInt(999999999));
        String zeroBegin = df.format(829011);
        System.out.println(random);
        System.out.println(zeroBegin);
    }
}
